const initialState = {
    // 初始频道
    channels: [],
    // 文章列表
    results: [],
    // 当前页码
    page: 1,
    // 每页条数
    per_page: 10,
    // 总条数
    total_count: 0
}

const article = (state = initialState, action) => {
    switch (action.type) {
        case 'article/setChannels':
            return {
                ...state,
                channels: action.payload
            }
        case 'article/setArticles':
            // 需要把返回的所有数据解构存起来
            return {
                ...state,
                ...action.payload
            }
        default:
            return state
    }
}

export default article